home *** CD-ROM | disk | FTP | other *** search
/ Champak 114 / Vol 114.iso / games / beat_the.swf / scripts / DefineSprite_175 / frame_1 / DoAction.as
Encoding:
Text File  |  2010-08-12  |  2.9 KB  |  141 lines

  1. this.init = function()
  2. {
  3.    var _loc1_ = this;
  4.    _loc1_.pState = 0;
  5.    _loc1_.pPumpNum = _loc1_._name.substr(4,1);
  6.    if(_loc1_.pPumpNum <= 3)
  7.    {
  8.       _loc1_.pPumpType = "down";
  9.    }
  10.    else
  11.    {
  12.       _loc1_.pPumpType = "up";
  13.    }
  14. };
  15. this.gameover = function()
  16. {
  17.    this.readOut_mc.stopReadout();
  18.    this.gotoAndPlay("closed");
  19. };
  20. this.openPump = function()
  21. {
  22.    this.gotoAndPlay("open");
  23. };
  24. this.slowPump = function()
  25. {
  26.    this.gotoAndPlay("finishing_" + this.pPumpType);
  27. };
  28. this.startPump = function()
  29. {
  30.    var _loc1_ = this;
  31.    _loc1_.pState = 3;
  32.    _loc1_._parent.pForeCourt.pumpStarted(_loc1_.pPumpNum);
  33.    _loc1_.gotoAndPlay("fuelling_" + _loc1_.pPumpType);
  34. };
  35. this.stopPump = function()
  36. {
  37.    var _loc1_ = this;
  38.    _loc1_.readOut_mc.stopReadout();
  39.    _loc1_._parent.pForeCourt.pumpDone(_loc1_.pPumpNum);
  40.    _loc1_._parent.pForeCourt.leavingSpace(_loc1_.pPumpNum - 1);
  41.    if(_loc1_.pState == 3)
  42.    {
  43.       _loc1_.gotoAndPlay("done");
  44.       _loc1_._parent.pStelios.showWin();
  45.    }
  46.    else
  47.    {
  48.       _loc1_.gotoAndPlay("sand");
  49.       _loc1_._parent["fuel" + _loc1_.pPumpNum + "_mc"].gotoAndPlay("sand_" + _loc1_.pPumpType);
  50.       if(_loc1_._parent.pLives > 1)
  51.       {
  52.          _loc1_._parent.pLives -= 1;
  53.          _loc1_._parent.lives_mc.reduceBy(22);
  54.          _loc1_._parent.pStelios.showLose();
  55.       }
  56.       else
  57.       {
  58.          _loc1_._parent.gameOver();
  59.          _loc1_._parent.pStelios.flyAway();
  60.       }
  61.    }
  62.    _loc1_.pState = 1;
  63. };
  64. this.checkPumpReadout = function()
  65. {
  66.    var _loc1_ = this;
  67.    if(_loc1_.pState == 3)
  68.    {
  69.       _loc1_.stopPump();
  70.    }
  71.    else if(_loc1_.pState == 4)
  72.    {
  73.       _loc1_.pState = 5;
  74.       _loc1_._parent["fuel" + _loc1_.pPumpNum + "_mc"].gotoAndPlay("petrol_" + _loc1_.pPumpType);
  75.       _loc1_._parent.pForeCourt.pumpDone(_loc1_.pPumpNum);
  76.    }
  77. };
  78. this.checkPumpCar = function()
  79. {
  80.    var _loc1_ = this;
  81.    if(_loc1_.pState == 0)
  82.    {
  83.       _loc1_.pState = 2;
  84.       _loc1_.gotoAndPlay("waiting");
  85.    }
  86.    else if(_loc1_.pState == 1)
  87.    {
  88.       _loc1_.startPump();
  89.    }
  90. };
  91. this.checkPumpStelios = function()
  92. {
  93.    var _loc1_ = this;
  94.    if(_loc1_.pState == 0)
  95.    {
  96.       _loc1_.pState = 1;
  97.    }
  98.    else if(_loc1_.pState == 2)
  99.    {
  100.       _loc1_.startPump();
  101.    }
  102.    else if(_loc1_.pState == 4)
  103.    {
  104.       _loc1_.pState = 3;
  105.    }
  106.    else if(_loc1_.pState == 5)
  107.    {
  108.       _loc1_.stopPump();
  109.    }
  110. };
  111. this.angryCar = function()
  112. {
  113.    this.gotoAndPlay("angry");
  114. };
  115. this.leavingPump = function()
  116. {
  117.    var _loc1_ = this;
  118.    if(_loc1_.pState == 2)
  119.    {
  120.       _loc1_.gotoAndPlay("lost_money");
  121.       _loc1_.pState = 0;
  122.    }
  123.    else if(_loc1_.pState == 5)
  124.    {
  125.       _loc1_.gotoAndPlay("overfill_" + _loc1_.pPumpType);
  126.    }
  127. };
  128. this.leftPump = function()
  129. {
  130.    var _loc1_ = this;
  131.    if(_loc1_.pState == 1)
  132.    {
  133.       _loc1_.pState = 0;
  134.    }
  135.    else if(_loc1_.pState == 3)
  136.    {
  137.       _loc1_.pState = 4;
  138.    }
  139. };
  140. this.init();
  141.